package com.kitty.web.controller;

import com.kitty.web.controller.BaseController;
import com.kitty.web.common.AjaxResult;
import com.kitty.web.core.page.TableDataInfo;
import com.kitty.web.domain.PRedisCache;
import com.kitty.web.system.cache.service.IPRedisCacheService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.*;

import java.util.List;


/**
 * redisController
 * 
 * @author soul
 * @date 2022-04-12
 */
@Controller
@RequestMapping("/system/cache")
public class PRedisCacheController extends BaseController
{
    private String prefix = "system/cache";

    @Autowired
    private IPRedisCacheService pRedisCacheService;


    @GetMapping()
    public String cache()
    {
        return prefix + "/cache";
    }

    @GetMapping("/queryCache")
    public String cache2() {
        return prefix + "/cache2";
    }
    //神魂配置

    @GetMapping("/shenhunCache")
    public String shenhunCache() {
        return prefix + "/shenhuncache";
    }
    //武魂配置

    @GetMapping("/wuhunCache")
    public String wuhunCache() {
        return prefix + "/wuhuncache";
    }
    //内丹配置

    @GetMapping("/neidanCache")
    public String neidanCache() {
        return prefix + "/neidancache";
    }
    //培元配置

    @GetMapping("/peiyuanCache")
    public String peiyuanCache() {
        return prefix + "/peiyuancache";
    }
    //ningshen配置

    @GetMapping("/ningshenCache")
    public String ningshenCache() {
        return prefix + "/ningshencache";
    }
    //七日登录配置

    @GetMapping("/qiridengluCache")
    public String qiridengluCache() {
        return prefix + "/qiridenglucache";
    }
    //meiriqiandao配置

    @GetMapping("/meiriqiandaoCache")
    public String meiriqiandaoCache() {
        return prefix + "/meiriqiandaocache";
    }
    //世道大会配置

    @GetMapping("/shidaodahuiCache")
    public String shidaodahuiCache() {
        return prefix + "/shidaodahuicache";
    }
    //地府世道大会配置

    @GetMapping("/difushidaoCache")
    public String difushidaoCache() {
        return prefix + "/difushidaocache";
    }
    //充值排行榜奖励配置

    @GetMapping("/chongzhiCache")
    public String chongzhiCache() {
        return prefix + "/chongzhicache";
    }
    //抽奖排行榜奖励配置

    @GetMapping("/choujiangrankCache")
    public String choujiangrankCache() {
        return prefix + "/choujiangrankcache";
    }

    //新人奖励配置

    @GetMapping("/xinrenjiangliCache")
    public String xinrenjiangliCache() {
        return prefix + "/xinrenjianglicache";
    }

    //一键改造配置

    @GetMapping("/yijiangaizaoCache")
    public String yijiangaizaoCache() {
        return prefix + "/yijiangaizaocache";
    }

    //集市管理

    @GetMapping("/jishiCache")
    public String jishiCache() {
        return prefix + "/jishicache";
    }

    //五行配置

    @GetMapping("/wuxingCache")
    public String wuxingCache() {
        return prefix + "/wuxingcache";
    }
    //PK配置

    @GetMapping("/pkCache")
    public String pkCache() {
        return prefix + "/pkcache";
    }

    //在线奖励配置

    @GetMapping("/onlinerewardCache")
    public String onlinerewardCache() {
        return prefix + "/onlinerewardcache";
    }

    //回收奖励配置

    @GetMapping("/huishouCache")
    public String huishouCache() {
        return prefix + "/huishoucache";
    }

    //充值比例配置

    @GetMapping("/chongzhibiliCache")
    public String chongzhibiliCache() {
        return prefix + "/chongzhibilicache";
    }

    //成长秘籍配置

    @GetMapping("/chengzhangmijiCache")
    public String chengzhangmijiCache() {
        return prefix + "/chengzhangmijicache";
    }

    //冲榜奖励配置

    @GetMapping("/chongbang")
    public String chongbangCache() {
        return prefix + "/chongbang";
    }

    //图鉴配置

    @GetMapping("/tujian")
    public String tujianCache() {
        return prefix + "/tujian";
    }

    //杂项配置

    @GetMapping("/zaxiang")
    public String zaxiang() {
        return prefix + "/zaxiangcache";
    }

    @GetMapping("/zaxiang2")
    public String zaxiang2() {
        return prefix + "/zaxiang2cache";
    }

    @GetMapping("/zaxiang3")
    public String zaxiang3() {
        return prefix + "/zaxiang3cache";
    }

    @GetMapping("/zaxiang4")
    public String zaxiang4() {
        return prefix + "/zaxiang4cache";
    }

    @GetMapping("/zaxiang5")
    public String zaxiang5() {
        return prefix + "/zaxiang5cache";
    }

    @GetMapping("/zaxiang6")
    public String zaxiang6() {
        return prefix + "/zaxiang6cache";
    }

    @GetMapping("/zaxiang7")
    public String zaxiang7() {
        return prefix + "/zaxiang7cache";
    }

    @GetMapping("/meirileiji")
    public String meirileiji() {
        return prefix + "/meirileijicache";
    }

    @GetMapping("/tianshu")
    public String tianshu() {
        return prefix + "/tianshu";
    }
    @GetMapping("/ai")
    public String ai() {
        return   "system/ai/AiManage";
    }



    @GetMapping("/chaojivip")
    public String chaojivip() {
        return prefix + "/chaojivip";
    }



    /**
     * 查询redis列表
     */

    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(PRedisCache pRedisCache)
    {
        startPage();
        List<PRedisCache> list = pRedisCacheService.selectPRedisCacheList(pRedisCache);
        return getDataTable(list);
    }


    @PostMapping("/queryDetailInfo")
    @ResponseBody
    public TableDataInfo queryDetailInfo(PRedisCache pRedisCache) {

        startPage();
        List<PRedisCache> list = pRedisCacheService.selectPRedisCacheList(pRedisCache);
        return getDataTable(list);
    }

    /**
     * 新增redis
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存redis
     */

    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(PRedisCache pRedisCache)
    {
        return toAjax(pRedisCacheService.insertPRedisCache(pRedisCache));
    }

    /**
     * 修改redis
     */
    @GetMapping("/edit/{id}")
    public String edit(@PathVariable("id") Long id, ModelMap mmap)
    {
        PRedisCache pRedisCache = pRedisCacheService.selectPRedisCacheById(id);
        mmap.put("pRedisCache", pRedisCache);
        return prefix + "/edit";
    }

    /**
     * 修改保存redis
     */

    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(PRedisCache pRedisCache)
    {
        return toAjax(pRedisCacheService.updatePRedisCache(pRedisCache));
    }

    /**
     * 删除redis
     */

    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(pRedisCacheService.deletePRedisCacheByIds(ids));
    }
}
